#ifndef GBLABEL_H
#define GBLABEL_H

#include "GBWidget.h"
#include "GBFont.h"

#include <string>
#include <vector>

class GBLabel : public GBWidget
{
public:
	struct LabelString
	{
		std::string string;
		matrix4 local;
	};

private:
	bool m_bIsShadowed;

	float m_lineSpacing;
	GBFont* m_pFont;

	Color m_shadowColor;
	vec2 m_shadowOffset;

	std::vector<LabelString> m_strings;

public:
	GBLabel(const GBLabel& ref) { Copy(&ref); }
	GBLabel(const char* szFontFace, const long pt, const Color fontColor = Color(1.0f, 1.0f, 1.0f, 1.0f));
	GBLabel(const std::string& szFontFace, const long pt, const Color fontColor = Color(1.0f, 1.0f, 1.0f, 1.0f));

	GBLabel();
	~GBLabel();

	void Update(const float fTimeStep);
	void Render();

	void Copy(const GBWidget* pRef);

	void SetFont(const char* szFontFace, const long pt) { m_pFont = GBFontFactory::Instance()->GetFont(szFontFace, pt); }
	void SetFont(const std::string& szFontFace, const long pt) { m_pFont = GBFontFactory::Instance()->GetFont(szFontFace.c_str(), pt); }
	void SetFont(GBFont* pFont) { if(pFont) m_pFont = pFont; }
	void SetLineSpacing(float lineSpacing) { m_lineSpacing = lineSpacing; }
	void SetString(const char* szString, ...);
	void SetShadowed(bool bIsShadowed) { m_bIsShadowed = bIsShadowed; }
	void SetShadowColor(Color shadowColor) { m_shadowColor = shadowColor; }
	void SetShadowOffset(vec2 shadowOffset) { m_shadowOffset = shadowOffset; }

	const GBFont* GetFont() const { return m_pFont; }
	const std::vector<LabelString>& GetString() const { return m_strings; }
	float GetLineSpacing() const { return m_lineSpacing; }
	bool IsShadowed() const { return m_bIsShadowed; }
	Color GetShadowColor() const { return m_shadowColor; }
	vec2 GetShadowOffset() const { return m_shadowOffset; }

	WidgetType Type() const { return WIDGET_TYPE_LABEL; }
	
};

#endif